package com.lotusfall.controller;

import com.lotusfall.pojo.MzResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class LoginController {

    /**
     * 处理没有认证过的请求
     * @return
     */
    @RequestMapping("/login")
    public String Login(){
        return "login";
    }

    /**
     * 处理认证成功的请求
     * @return
     */
    @RequestMapping("/main2")
    public String main2(){
        return "index";
    }

    /**
     * 处理认证失败的请求--返回json格式
     * @return
     */
    @RequestMapping("/fail")
    @ResponseBody
    public MzResult fail(){
        return new MzResult("用户名或密码错误！");
    }


    @RequestMapping("/error403")
    public String error403(){
        return "error403";
    }
}
